package com.burst.reptile.modular.web.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.burst.reptile.framework.web.result.Result;
import com.burst.reptile.modular.web.entity.ZpWebinfo;
import com.burst.reptile.modular.web.service.IZpWebinfoService;

import lombok.RequiredArgsConstructor;

/**
 * <p>
 * 网站信息相关协议 前端控制器
 * </p>
 *
 * @author wujin
 * @since 2020-07-06
 */
@RestController
@RequestMapping("/web/webinfo")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ZpWebinfoController {
	
	private final IZpWebinfoService webinfoService;
	
	/**
	 * 隐私政策
	 * @return
	 */
	@GetMapping("/privacy")
	public Result<Object> getInfo(){
		return Result.success(webinfoService.getZpWebinfo("1"));
	}
	
	/**
	 * 关于我们
	 * @return
	 */
	@GetMapping("/aboutshuaixiaopu")
	public Result<Object> aboutshuaixiaopu(){
		return Result.success(webinfoService.getZpWebinfo("2"));
	}
	
	/**
	 * 联系我们
	 * @return
	 */
	@GetMapping("/contactus")
	public Result<Object> contactus(){
		return Result.success(webinfoService.getZpWebinfo("3"));
	}
	
	/**
	 * 平台简介
	 * @return
	 */
	@GetMapping("/introduction")
	public Result<Object> introduction(){
		return Result.success(webinfoService.getZpWebinfo("4"));
	}
	
	/**
	 * 用户协议
	 * @return
	 */
	@GetMapping("/useragreement")
	public Result<Object> useragreement(){
		return Result.success(webinfoService.getZpWebinfo("5"));
	}
	
	/**
	 * 添加
	 * @return
	 */
	@PostMapping("/add")
	@PreAuthorize("@ss.hasPermi('zp:web:info')")
	public Result<Object> add(@Validated @RequestBody ZpWebinfo webinfo){
		return Result.success(webinfoService.add(webinfo));
	}
	
}
